//package com.example.score.config;
//
//import javax.annotation.PostConstruct;
//
//import org.apache.rocketmq.client.producer.DefaultMQProducer;
//import org.apache.rocketmq.spring.core.RocketMQTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//
//import lombok.extern.slf4j.Slf4j;
//
//@Slf4j
//@Configuration
//public class RocketMQConfig {
//
//    @Value("${rocketmq.name-server}")
//    private String nameServer;
//
//    @Value("${rocketmq.producer.group}")
//    private String producerGroup;
//
//    @Autowired
//    private RocketMQTemplate rocketMQTemplate;
//
//    public static final String EXAM_DETAIL_TOPIC = "TBW102" +
//            "" +
//            "" +
//            "" +
//            "";
//
//    @PostConstruct
//    public void init() {
//        try {
//            DefaultMQProducer producer = rocketMQTemplate.getProducer();
//            producer.getDefaultMQProducerImpl()
//                   .getmQClientFactory()
//                   .getMQClientAPIImpl()
//                   .getTopicRouteInfoFromNameServer(EXAM_DETAIL_TOPIC, 3000);
//
//            log.info("RocketMQ连接成功, nameServer: {}, producerGroup: {}, topic: {}",
//                nameServer, producerGroup, EXAM_DETAIL_TOPIC);
//        } catch (Exception e) {
//            log.error("RocketMQ连接失败: {}", e.getMessage(), e);
//        }
//    }
//}